package com.goodving.guli.utility;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015-11-17.
 */
public class C1285g {
    public static ArrayList<DailyInfoContainer> m11509a(List<CalenderData> list) {
        int i = 0;
        LdlDate.m8856a();
        ArrayList<DailyInfoContainer> arrayList = new ArrayList();
        if (list.size() == 0) {
            return null;
        }
        DailyInfoContainer dailyInfoContainer = new DailyInfoContainer();
        int r = ((CalenderData) list.get(0)).f6087c.getMonth();
        int q = ((CalenderData) list.get(0)).f6087c.getDate();
        int b = C1466h.m11954b(((CalenderData) list.get(0)).f6087c);
        LdlDate a = LdlDate.m8859a(C1466h.m11946a(((CalenderData) list.get(0)).f6087c).getTime());
        int s = a.getDay();
        dailyInfoContainer.setMonth(r);
        dailyInfoContainer.setStartDay(b - 1);
        C1285g.m11510a(s, dailyInfoContainer);
        for (s = 1; s < q; s++) {
            dailyInfoContainer.addDailyInfo(new CalenderData(-1, -1, a));
            a = a.m8882o();
        }
        while (i < list.size()) {
            DailyInfoContainer dailyInfoContainer2;
            int r2 = ((CalenderData) list.get(i)).f6087c.getMonth();
            if (r2 == r) {
                dailyInfoContainer.addDailyInfo((CalenderData) list.get(i));
                s = r;
                dailyInfoContainer2 = dailyInfoContainer;
            } else {
                arrayList.add(dailyInfoContainer);
                dailyInfoContainer2 = new DailyInfoContainer();
                s = C1466h.m11954b(((CalenderData) list.get(i)).f6087c);
                dailyInfoContainer2.setStartDay(s - 1);
                C1285g.m11510a(s, dailyInfoContainer2);
                dailyInfoContainer2.addDailyInfo((CalenderData) list.get(i));
                dailyInfoContainer2.setMonth(r2);
                s = r2;
            }
            i++;
            dailyInfoContainer = dailyInfoContainer2;
            r = s;
        }
        r = ((CalenderData) list.get(list.size() - 1)).f6087c.getDate();
        i = ((CalenderData) list.get(list.size() - 1)).f6087c.m8891x();
        int i2 = r;
        LdlDate o = ((CalenderData) list.get(list.size() - 1)).f6087c.m8882o();
        for (s = i2; s < i; s++) {
            dailyInfoContainer.addDailyInfo(new CalenderData(-1, -1, o));
            o = o.m8882o();
        }
        arrayList.add(dailyInfoContainer);
        return arrayList;
    }

    private static void m11510a(int i, DailyInfoContainer dailyInfoContainer) {
        CalenderData calenderData = new CalenderData(-2, -2, LdlDate.m8856a());
        for (int i2 = 1; i2 < i; i2++) {
            dailyInfoContainer.addDailyInfo(calenderData);
        }
    }

    public static ArrayList<DailyInfoContainer> m11511b(List<CalenderData> list) {
        int i = 0;
        ArrayList<DailyInfoContainer> arrayList = new ArrayList();
        if (list.size() == 0) {
            return null;
        }
        int i2;
        DailyInfoContainer dailyInfoContainer = new DailyInfoContainer();
        int s = ((CalenderData) list.get(0)).f6087c.getDay();
        LdlDate c1211c = (LdlDate)((CalenderData) list.get(0)).f6087c;
        if (s > 1) {
            LdlDate c1211c2 = c1211c;
            for (i2 = 1; i2 < s; i2++) {
                dailyInfoContainer.addDailyInfo(0, new CalenderData(-1, -1, c1211c2.m8881n()));
                c1211c2 = c1211c2.m8881n();
            }
            c1211c = (LdlDate)((CalenderData) list.get(0)).f6087c;
        }
        DailyInfoContainer dailyInfoContainer2 = dailyInfoContainer;
        LdlDate c1211c3 = c1211c;
        while (i < list.size()) {
            if (((CalenderData) list.get(i)).f6087c.equals(c1211c3)) {
                dailyInfoContainer2.addDailyInfo((CalenderData) list.get(i));
            } else {
                arrayList.add(dailyInfoContainer2);
                dailyInfoContainer2 = new DailyInfoContainer();
                dailyInfoContainer2.addDailyInfo((CalenderData) list.get(i));
                c1211c3 = (LdlDate)((CalenderData) list.get(i)).f6087c;
            }
            i++;
        }
        int s2 = ((CalenderData) list.get(list.size() - 1)).f6087c.getDay();
        LdlDate c1211c4 = (LdlDate)((CalenderData) list.get(list.size() - 1)).f6087c;
        if (s2 != 7) {
            for (i2 = s2 + 1; i2 <= 7; i2++) {
                dailyInfoContainer2.addDailyInfo(new CalenderData(-1, -1, c1211c4.m8882o()));
                c1211c4 = c1211c4.m8882o();
            }
        }
        arrayList.add(dailyInfoContainer2);
        return arrayList;
    }
}

